-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wire up unstable rustc --check-cfg to rustdoc #94154
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
b5de273
to
6741b88
Compare
This was a weird! Simply doing this I had to manually had some extra normalizations (based on other rustdoc test) to make it fail locally. I think it will now pass on CI as well.
|
Can you also add it into the rustdoc book please? Also cc @petrochenkov @camelid |
I don't have context for this change, but I don't think it's really necessary to discuss it now since it's unstable? |
Add -Z check-cfg-features to enable compile-time checking of features This pull-request implements the "[Cargo support](https://rust-lang.github.io/rfcs/3013-conditional-compilation-checking.html#cargo-support)" section of [RFC 3013: Checking conditional compilation at compile time](https://rust-lang.github.io/rfcs/3013-conditional-compilation-checking.html#checking-conditional-compilation-at-compile-time). The support is added in the form of an new unstable flags: `-Z check-cfg-features` that pass all possible features of a package to `rustc` unstable `--check-cfg` command line as `--check-cfg=values(feature, ...)`. This enables compile time checking of `feature` values in `#[cfg]`, `cfg!` and `#[cfg_attr]`. This new flag currently only affects `rustc` but `rustdoc` support will be added as soon as [it's support](rust-lang/rust#94154) is merged. Note than the intent is that this command line options become the default when stabilizing as suggested in the RFC: > [..] it seems uncontroversial for Cargo to enable checking for feature = "..." values immediately [..]
176df64
to
a31ae15
Compare
Thanks! @bors: r+ |
📌 Commit a31ae15 has been approved by |
…eGomez Wire up unstable rustc --check-cfg to rustdoc This pull-request wire up the new unstable `--check-cfg` option from `rustc` to `rustdoc` as [requested](rust-lang#93915 (comment)) in the [pull-request](rust-lang#93915) that introduce `--check-cfg`. The motivation was describe in the original PR by `@jyn514` who wrote rust-lang#89346 (comment): > > add plumbing to pass --check-cfg from rustdoc (do we want this one?) > > It would be useful, I think, it catches issues like cfg(doctst) or something (and in general I would like expansion to match rustc as closely as possible).
…askrgr Rollup of 4 pull requests Successful merges: - rust-lang#93850 (Don't ICE when an extern static is too big for the current architecture) - rust-lang#94154 (Wire up unstable rustc --check-cfg to rustdoc) - rust-lang#94353 (Fix debug_assert in unused lint pass) - rust-lang#94366 (Add missing item to release notes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Add -Z check-cfg-features support for rustdoc This PR is a follow to #10408 where support for compile-time checking of features was implemented for `rustc`. At the time `rustdoc` support wasn't yet merged, but now that it has been [merged](rust-lang/rust#94154), this pull-request add support for it in the `doc` and `test --doc` (doctest) mode. r? `@alexcrichton`
This pull-request wire up the new unstable
--check-cfg
option fromrustc
torustdoc
as requested in the pull-request that introduce--check-cfg
.The motivation was describe in the original PR by @jyn514 who wrote #89346 (comment):